# Maintainer: David Runge <dvzrv@archlinux.org>
# Contributor: Llewelyn Trahaearn <WoefulDerelict at GMail dot com>
# Contributor: SpepS <dreamspepser at yahoo dot it>

_name=pyliblo
pkgname=python-pyliblo
pkgver=0.10.0
pkgrel=11
pkgdesc='Python wrapper for the liblo OSC library'
arch=(loong64 x86_64)
url="http://das.nasophon.de/pyliblo/"
license=(LGPL2.1)
depends=(
  glibc
  liblo
  python
)
makedepends=(
  cython
  python-build
  python-installer
  python-setuptools
  python-wheel
)
checkdepends=(python-pytest)
source=($_name-$pkgver.tar.gz::https://github.com/dsacre/pyliblo/archive/refs/tags/$pkgver.tar.gz)
sha512sums=('c475ddfea9abf9e155deed12ab01ff2e585a6ed2946fac8d5017f36e3aee84b294f21cf5d0dd79098a4bd2f7911beed791bed67124cec3fc4bbd5087d42b4eed')
b2sums=('dc14ab1dd64cdff5946d0e05a871c7cc75be89e8a57b12302cbee3bbeab1e9e1cfedce493fd4dbb6a4ba5a095a8539a4d4b7c9fe04431cf8376812b01bf78001')

build() {
  cd $_name-$pkgver
  python -m build --wheel --no-isolation
}

check() {
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")

  cd $_name-$pkgver
  python -m installer --destdir=test_dir dist/*.whl
  export PYTHONPATH="test_dir/$site_packages:$PYTHONPATH"
  pytest -vv
}

package_python-pyliblo() {
  cd $_name-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -vDm 644 {NEWS,README} -t "$pkgdir/usr/share/doc/$pkgname/"
}
